<?php
/**
 *
 * @author yupoxiong<i@yupoxiong.com>
 */

declare (strict_types=1);

namespace app\admin\traits;

use support\Response;

trait AdminDisableTrait
{
    /**
     * 禁用数据
     * @return Response
     */
    public function disable(): Response
    {
        $model = $this->model;
        $id = (request())->input('id');

        $result = $model->whereIn('id', $id)->update(['status' => 0]);
        return $result ? admin_success('操作成功', [], URL_RELOAD) : admin_error();
    }
}